package com.biz.primus.management.geo.feign;

import com.biz.primus.base.vo.PageVo;
import com.biz.primus.common.vo.SpringPageVO;
import com.biz.primus.management.geo.degraded.DegradedGeoFeignClient;
import com.biz.primus.model.geo.vo.*;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * GeoFeignClient
 *
 * @author JKLiues
 * @date 2017年10月28日
 */
@FeignClient(qualifier = "geoFeignClient", name = "service-geo", fallback = DegradedGeoFeignClient.class)
public interface GeoFeignClient {
    /**
     * 更新或修改省信息
     *
     * @param reqVo 更新请求Vo
     */
    @PostMapping("soa/geoService/updateProvinceInfo")
    void updateProvinceInfo(@RequestBody GeoUpdateReqVo reqVo);

    /**
     * 更新或修改市信息
     *
     * @param reqVo 更新请求Vo
     */
    @PostMapping("soa/geoService/updateCityInfo")
    void updateCityInfo(@RequestBody GeoUpdateReqVo reqVo);

    /**
     * 更新或修改区信息
     *
     * @param reqVo 更新请求Vo
     */
    @PostMapping("soa/geoService/updateDistrictInfo")
    void updateDistrictInfo(@RequestBody GeoUpdateReqVo reqVo);

    /**
     * 显示数据库中全部的省信息
     *
     * @param reqVo 省分页查询请求VO
     */
    @PostMapping("soa/geoService/provinces")
    SpringPageVO<ProvinceListRespVo> backProvinceList(@RequestBody PageVo reqVo);

    /**
     * 显示数据库中市信息
     *
     * @param reqVo 市分页查询请求Vo
     */
    @PostMapping("soa/geoService/cities")
    SpringPageVO<CityListRespVo> backCitesList(@RequestBody CityPageListReqVo reqVo);

    /**
     * 显示数据库中区信息
     *
     * @param reqVo 区县分页查询请求VO
     */
    @PostMapping("soa/geoService/districts")
    SpringPageVO<DistrictListRespVo> backDistrictList(@RequestBody DistrictPageListReqVo reqVo);


    /**
     * 根据ID查省
     *
     * @param provinceId 省ID
     */
    @GetMapping("soa/geoService/findProvinceById")
    ProvinceDetailRespVo findProvinceById(@RequestParam("provinceId") Long provinceId);


    /**
     * 根据Id查市
     *
     * @param cityId 市Id
     */
    @GetMapping("soa/geoService/findCityById")
    CityDetailRespVo findCityById(@RequestParam("cityId") Long cityId);

    /**
     * 根据id查区县
     *
     * @param districtId 区县ID
     */
    @GetMapping("soa/geoService/findDistrictById")
    DistrictDetailRespVo findDistrictById(@RequestParam("districtId") Long districtId);
}